package com.googlecode.bip.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import javax.naming.NamingException;
import com.googlecode.bip.dao.utils.Listable;
import com.googlecode.bip.entity.IUserReferent;
import com.googlecode.bip.entity.UserReferent;

/**
 * TODO: Doc!
 *
 * @author Claude CHOISNET
 */
public abstract class UserReferentDAO
        implements Listable<IUserReferent>
{
    private static final long serialVersionUID = 1L;

    /**
     * Build UserValueDAO
     */
    public UserReferentDAO()
    {
    }

    @Override //Listable<IQuestion>
    public IUserReferent newInstance(final ResultSet rSet )
        throws SQLException
    {
        return new UserReferent().set( rSet );
    }

    /**
     *
     * @param iduser
     * @param idreferent
     * @return
     * @throws NamingException
     * @throws SQLException
     */
    public abstract IUserReferent findUserReferent(
        int  iduser,
        int  idreferent
        ) throws NamingException, SQLException;

    /**
     *
     * @param iduser
     * @return
     * @throws NamingException
     * @throws SQLException
     */
    public abstract List<IUserReferent> findUserReferentList(
        int  iduser
        ) throws NamingException, SQLException;

    /**
     *
     * @param userReferent
     * @return
     * @throws NamingException
     * @throws SQLException
     */
    public abstract boolean insertUserReferent( IUserReferent userReferent )
        throws NamingException, SQLException;

    /**
     *
     * @param iduser
     * @param idreferent
     * @return
     * @throws NamingException
     * @throws SQLException
     */
    public abstract boolean deleteUserReferent(
        int  iduser,
        int  idreferent
        ) throws NamingException, SQLException;

    /**
     *
     * @param userReferent
     * @return
     * @throws NamingException
     * @throws SQLException
     */
    public boolean deleteUserReferent(
           IUserReferent userReferent
           ) throws NamingException, SQLException
    {
       return deleteUserReferent(
           userReferent.getIdUser(),
           userReferent.getIdReferent()
           );
    }

    /* NOT UPDATE
    public abstract boolean updateUserReferent( ... )
        throws NamingException, SQLException;
    */
}

